{template admin/head}
<script type="text/javascript" src="{STATICDIR}third/plupload/plupload.full.min.js"></script>
<body>
<script type="text/javascript">
var ajaxparam = {
		'url' : '{CONTROL_URL}?a={$action}'
};

function submitcheck()
{
	return true;
}

function saveinfo()
{
	if(!submitcheck())
	{
		return;
	}
	
	layer.confirm('请再次确认信息是否填写正确？', {
		  btn: ['确认','取消'] //按钮
	}, function(){
		
		var url = '{SITE_URL}ajax/admin.php?m=chuliFanli';
	
		var data = $('#savedata').serialize();
		
		$('#error_qixian').text('');
		var callback = function(data)
		{
			if(data.sign == -2)
			{
				window.location = data.url;
			}
			else
			{
				if(data.sign == 1)
				{
					//添加成功,返回列表页
					layer.alert(data.msg,function(){
						window.location = $('#gotoList').attr('href');
					});
				}
				else if(data.sign == 88)
				{
					layer.msg(data.msg);
					$('#error_qixian').text(data.msg);

					$('#start').focus();
				}
				
				else
				{
					if(data.msg)
					{
						layer.msg(data.msg);
					}
					else
					{
						layer.msg('操作失败');
					}
				}
			}
		};
		makeAjax('post',url,data,callback);
		
		
	});
	
	
}


</script>
<div class="wrapper">
	<div class="crumbs"><a href="javascript:;">返利管理</a> &gt;<a id="gotoList" href="{SITE_URL}admin.php?a=fanliM">返利列表</a> &gt; <span>处理返利信息</span> </div>
	<div class="container_tit clearfix mb20 ft14">
		
	<form id="savedata">
		<input type="hidden" name="id" value="{$info[id]}" />
		<h2 class="form_tit">返利信息</h2>
		<div class="form_item clearfix">
		    <p class="clearfix">
				<label class="name">手机号：</label>
				<label style="display: inline-block;line-height: 30px;height: 30px;width: 150px;">{$info[phone]}</label>
			</p>
		</div>
		<div class="form_item clearfix">
		    <p class="clearfix">
				<label class="name">用户姓名：</label>
				<label style="display: inline-block;line-height: 30px;height: 30px;width: 150px;">{$info[user][nickname]}</label>
			</p>
		</div>
		<div class="form_item clearfix">
		    <p class="clearfix">
				<label class="name">产品名称：</label>
				<label style="display: inline-block;line-height: 30px;height: 30px;width: 150px;">{$info[chanpin][name]}</label>
			</p>
		</div>
		<div class="form_item clearfix">
		    <p class="clearfix">
				<label class="name">投资项目名称：</label>
				<label style="display: inline-block;line-height: 30px;height: 30px;width: 150px;">{$info[item][name]}</label>
			</p>
		</div>
		
		<div class="form_item clearfix">
		    <p class="clearfix">
				<label class="name">投资金额：</label>
				<label style="display: inline-block;line-height: 30px;height: 30px;width: 150px;">{$info[money]}</label>
			</p>
		</div>
		
		<div class="form_item clearfix">
		    <p class="clearfix">
				<label class="name">返利方式：</label>
				<label style="display: inline-block;line-height: 30px;height: 30px;width: 150px;">
					{if $info[item][type] == 1}
						返利比例-{$info[item][fanli]}%
					{elseif $info[item][type] == 2}
						固定金额-{$info[item][fanli]}元
					{/if}
				</label>
			</p>
		</div>
		
		<div class="form_item clearfix">
		    <p class="clearfix">
				<label class="name">返利金额：</label>
				<label style="display: inline-block;line-height: 30px;height: 30px;width: 150px;">{$info['fanli']}</label>
			</p>
		</div>

		<div class="form_item clearfix">
		    <p class="clearfix">
				<label class="name">申请时间：</label>
				<label style="display: inline-block;line-height: 30px;height: 30px;width: 150px;">{php echo time_formart($info['addtime'],2)}</label>
			</p>
		</div>
		
		<h2 class="form_tit">处理信息</h2>
		{if $info[status] == '1'}
			<div class="form_item clearfix">
			    <p class="clearfix">
					<label class="name">投资时间：</label>
					<input type="text" name="tzsj" id="start" value="{php echo time_formart($fanli['tzsj'],4)}" class="text w200" />
					<span id="error_qixian" style="color:red;"></span>
			    </p>
			</div>
			
			<div class="form_item clearfix">
			    <p class="clearfix">
					<label class="name">投资期限：</label>
					<input type="text" name="qixian" value="{$fanli[qixian]}" class="text w200" />
				</p>
			</div>
			
			<div class="form_item clearfix">
			    <p class="clearfix">
					<label class="name">处理结果：</label>
					<input style="vertical-align: middle;" class="checkbox" type="radio" name="type" value="1" />
					<label style="display: inline-block;line-height: 30px;height: 30px;" class="mr20">同意</label>
					<input style="vertical-align: middle;" class="checkbox" type="radio" name="type" value="2" />
					<label style="display: inline-block;line-height: 30px;height: 30px;">拒绝</label>
				</p>
			</div>
			
			<div class="form_item clearfix">
			    <p class="clearfix">
					<label class="name">备注信息：</label>
					<textarea id="shuoming" name="shuoming" class="w340" rows="5">{$fanli[shuoming]}</textarea>
				</p>
			</div>
			
			<div class="form_item clearfix">
			    <p class="clearfix">
					<label class="name">凭证信息：</label>
					<a id="btn1" href="javascript:;" class="btnyellow mr15">上传图片</a>
					<input type="hidden" id="pic" name="pic" value="{$info[pic]}" />
				</p>
			</div>
			<div class="form_item clearfix">
			    <p class="clearfix">
					<label class="name"></label>
					<img id="img_pic" src="{UPLOAD_IMG_URL}{$info[pic]}"  style="max-width: 400px;max-height: 200px;" />
				</p>
			</div>
			
			
	        <div class="form_item clearfix">
				<p class="clearfix">
					<label class="name"></label>
				    <input type="button" class="btnblue" value="提交" onclick="saveinfo()" />
				</p>
			</div>
		{else}
			<div class="form_item clearfix">
			    <p class="clearfix">
					<label class="name">投资时间：</label>
					<label style="display: inline-block;line-height: 30px;height: 30px;width: 150px;">{php echo time_formart($info['tzsj'],2)}</label>
				</p>
			</div>
			<div class="form_item clearfix">
			    <p class="clearfix">
					<label class="name">投资期限：</label>
					<label style="display: inline-block;line-height: 30px;height: 30px;width: 150px;">{$info[qixian]}</label>
				</p>
			</div>
			<div class="form_item clearfix">
			    <p class="clearfix">
					<label class="name">处理结果：</label>
					<label style="display: inline-block;line-height: 30px;height: 30px;width: 150px;">
						{if $info[status] == '2'}
							同意
						{/if}
						{if $info[status] == '3'}
							拒绝
						{/if}
					</label>
				</p>
			</div>
			<div class="form_item clearfix">
			    <p class="clearfix">
					<label class="name">备注信息：</label>
					<label style="display: inline-block;line-height: 30px;height: 30px;width: 150px;">{$info[shuoming]}</label>
				</p>
			</div>
			<div class="form_item clearfix">
			    <p class="clearfix">
					<label class="name">凭证信息：</label>
					<img id="img_pic" src="{UPLOAD_IMG_URL}{$info[pic]}"  style="max-width: 400px;max-height: 200px;" />
				</p>
			</div>
		{/if}
    </form>
    </div>
</div>
</body>
{template admin/foot}

<script>
    var uploader = new plupload.Uploader({//创建实例的构造方法
        runtimes: 'html5,flash,silverlight,html4', //上传插件初始化选用那种方式的优先级顺序
        browse_button: 'btn1', // 上传按钮
        url: "{SITE_URL}ajax/uploadImgs.php", //远程上传地址
        flash_swf_url: '{STATICDIR}plupload/Moxie.swf', //flash文件地址
        silverlight_xap_url: '{STATICDIR}plupload/Moxie.xap', //silverlight文件地址
        filters: {
            max_file_size: '2mb', //最大上传文件大小（格式100b, 10kb, 10mb, 1gb）
            mime_types: [//允许文件上传类型
                {title: "files", extensions: "jpg,png,gif,jpeg"}
            ]
        },
        multi_selection: false, //true:ctrl多文件上传, false 单文件上传
        init: {
            FilesAdded: function(up, files) { //文件上传前
                if ($("#ul_pics").children("li").length > 30) {
                    ts("您上传的图片太多了！");
                    uploader.destroy();
                } else {
                    var li = '';
                    plupload.each(files, function(file) { //遍历文件
                        li += "<li id='" + file['id'] + "'><div class='progress'><span class='bar'></span><span class='percent'>0%</span></div></li>";
                    });
                    $("#ul_pics").append(li);
                    uploader.start();
                }
            },
            UploadProgress: function(up, file) { //上传中，显示进度条
         var percent = file.percent;
                $("#" + file.id).find('.bar').css({"width": percent + "%"});
                $("#" + file.id).find(".percent").text(percent + "%");
            },
            FileUploaded: function(up, file, info) { //文件上传成功的时候触发
	               var data = eval("(" + info.response + ")");
	               
	                var picurl = '{UPLOAD_IMG_URL}';
	                $("#img_pic").attr('src',picurl+data.name);
	                $("#pic").val(data.name);
	              //  _upload_callback(data.name,data.size);
	            },
            Error: function(up, err) { //上传出错的时候触发
                layer.msg(err.message);
            },
            UploadComplete:function()
            {
            	layer.msg('上传成功');

            	//window.location = window.location;
            }
        }
    });
    uploader.init();
</script>
